function HandleTableRowProduct(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;
  this._popupBox = new PopupBox();
  this._popupBox2 = new PopupBox2();
  
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : function() {};
  
  this._createElements();
};

HandleTableRowProduct.prototype._createElements = function() {
  var options, model, state, transitions = [], a, button, _self = this;
  this._gui.customer.appendChild(document.createTextNode(this._item.branch + DlmanageUtils.customerId(this._item.customerId)));
  this._gui.checked.defaultChecked = this._item._received;
  this._gui.checked.onclick = function() { _self._item._received = this.checked; };
  this._gui.checked.style.display = ((this._item.pi_model == Constant.MODEL_NAME_USER_VIDEOGRAPHER && this._item.state == 7) || (this._item.pi_model == Constant.MODEL_NAME_PRODUCT_COMMON && this._item.state == 16) || (this._item.pi_model == Constant.MODEL_NAME_PRODUCT_RETOUCH_MAGAZINE && this._item.state == 16) || (this._item.pi_model == Constant.MODEL_NAME_PRODUCT_4X6 && this._item.state == 10) || (this._item.pi_model == Constant.MODEL_NAME_PRODUCT_VIDEODVD && this._item.state == 5)) ? 'inline' : 'none';
  this._gui.order.appendChild(document.createTextNode(this._item.orderFlag));
  
  if (this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_VIDEODVD|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_4X6|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_RETOUCH|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_RETOUCH_MAGAZINE|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_COMMON|escape:javascript}}') {
    var span = document.createElement('span');
    span.style.fontWeight = 'bold';
    span.appendChild(document.createTextNode(this._item.pi_quantity + 'X'));
    this._gui.name.appendChild(span);
  }

  this._gui.name.appendChild(document.createTextNode(this._item.title));
  if (this._item.pi_selects.length > 0 && (this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_VIDEODVD|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_4X6|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_RETOUCH|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_RETOUCH_MAGAZINE|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_PRODUCT_COMMON|escape:javascript}}' ||
      this._item.pi_model == '{{$smarty.const.MODEL_NAME_ALBUM_DESIGN|escape:javascript}}')) {
    a = document.createElement('a');
    a.style.fontSize = '10px';
    a.href = '#';
    a.appendChild(document.createTextNode('Info'));
    a.onclick = function() { var func1 = function() { _self._popupBox2._close(); };
                             var div = document.createElement('div');
                             MiscUtils.dialog(_self._popupBox2, DOMUtils.findPos(this), div, func1, null, {t: _self._item.pi_name, width: 510, height: 100});
                             new DialogDetails(div, _self._item, { orderId: _self._item.orderId, hidePrice: _self._options.hidePrice });
                             return false;
                           };
    this._gui.name.appendChild(a);
  }
  
  model = Manage.map()[this._item.pi_model];
  for (var i = 0, il = model.states.length; i < il; i++) {
    var s = model.states[i];
    if (this._item.state == s.id) {
      state = s;
      break;
    }
  }
  
  for (var i = 0, il = model.transitions.length; i < il; i++) {
    var t = model.transitions[i];
    if (this._item.state == t.source.id) {
      transitions[transitions.length] = t;
    }
  }
  
  options = MiscUtils.clone(this._options);
  options.transitions = transitions;
  options.callbackFunc = function() { _self._popupBox._close();
                                      _self._callbackFunc();
                                    };
  
  this._gui.quantity.appendChild(document.createTextNode(state.title));
//  if (this._item.events.length > 0) {
    a = document.createElement('a');
    a.style.fontSize = '10px';
    a.href = '#';
    a.appendChild(document.createTextNode('Log'));
    a.onclick = function() { var func1 = function() { _self._popupBox2._close(); };
                             var div = document.createElement('div');
                             MiscUtils.dialog(_self._popupBox2, DOMUtils.findPos(this), div, func1, null, {t: _self._item.title, width: 820, height: 100});
                             new DialogHistory(div, _self._item, options);
                             return false;
                           };
    this._gui.quantity.appendChild(a);
//  }
};